//package wilfred.alpha;
//
//
//import java.io.IOException;
//import java.io.InputStream;
//import java.io.OutputStream;
//import java.util.UUID;
//
//import com.example.android.BluetoothChat.BluetoothChat;
//import com.example.android.BluetoothChat.BluetoothChatService.AcceptThread;
//import com.example.android.BluetoothChat.BluetoothChatService.ConnectThread;
//import com.example.android.BluetoothChat.BluetoothChatService.ConnectedThread;
//
//import android.bluetooth.BluetoothAdapter;
//import android.bluetooth.BluetoothDevice;
//import android.bluetooth.BluetoothServerSocket;
//import android.bluetooth.BluetoothSocket;
//import android.content.Context;
//import android.os.Bundle;
//import android.os.Handler;
//import android.os.Message;
//import android.util.Log;
//
//public class wilfredBlueTooth {
//
//
//	//server socket names
//	private static final String secureConnection = "Secured";
//	private static final String insecureConnection = "Insecured";
//
//	// Unique UUID for this application ??????? whats mine???
//	private static final UUID MY_UUID_SECURE =
//			UUID.fromString("fa87c0d0-afac-11de-8a39-0800200c9a66");
//	private static final UUID MY_UUID_INSECURE =
//			UUID.fromString("8ce255c0-200a-11e0-ac64-0800200c9a66");
//
//	// Member fields
//	private final BluetoothAdapter BTAdapter;
//	private final Handler BTHandler;
//	private AcceptThread BTSecureAcceptThread;
//	private AcceptThread BTInsecureAcceptThread;
//	private ConnectThread BTConnectThread;
//	private ConnectedThread BTConnectedThread;
//	private int BTState;
//
//	// Set state needed
//	public static final int STATE_NA = 0;       
//	public static final int STATE_LISTEN = 1;     
//	public static final int STATE_CONNECTING = 2; 
//	public static final int STATE_CONNECTED = 3;  
//	/**
//     * Constructor. Prepares a new BluetoothChat session.
//     * @param context  The UI Activity Context
//     * @param handler  A Handler to send messages back to the UI Activity
//     */
//    public wilfredBlueTooth(Context context, Handler handler) {
//        BTAdapter = BluetoothAdapter.getDefaultAdapter();
//        BTState = STATE_NA;
//        BTHandler = handler;
//    }
//
//    /**
//     * Set the current state of the chat connection
//     * @param state  An integer defining the current connection state
//     */
//    private synchronized void setState(int state) {
//        if (D) Log.d(TAG, "setState() " + BTState + " -> " + state);
//        BTState = state;
//
//        // Give the new state to the Handler so the UI Activity can update
//        //TODO
//        BTHandler.obtainMessage(wilfredBlueTooth.MESSAGE_STATE_CHANGE, state, -1).sendToTarget();
//    }
//
//    /**
//     * Return the current connection state. */
//    public synchronized int getState() {
//        return BTState;
//    }
//    
//    /**
//     * Start the chat service. Specifically start AcceptThread to begin a
//     * session in listening (server) mode. Called by the Activity onResume() */
//    public synchronized void start() {
//
//
//        // Cancel any thread attempting to make a connection
//        if (BTConnectThread != null) {BTConnectThread.cancel(); BTConnectThread = null;}
//
//        // Cancel any thread currently running a connection
//        if (BTConnectedThread != null) {BTConnectedThread.cancel(); BTConnectedThread = null;}
//
//        setState(STATE_LISTEN);
//
//        // Start the thread to listen on a BluetoothServerSocket
//        if (BTSecureAcceptThread == null) {
//            BTSecureAcceptThread = new AcceptThread(true);
//            BTSecureAcceptThread.start();
//        }
//        if (BTInsecureAcceptThread == null) {
//            BTInsecureAcceptThread = new AcceptThread(false);
//            mInsecureAcceptThread.start();
//        }
//    }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//}
//
